





def hook(function_name):

    def war(a):
        print("---------------")
        res =function_name()
        print(res)
        with open("a.txt","w",encoding="utf-8") as f:
                f.write(res)
        print(a)
        print("+++++++++++++++++++")
        return res
    return war


def test():
    print("娟娟")
    return "娟娟"

# 传入方法名，返回一个war对象，对象加括号就调用了war
# hook(test)("123")  # 为你理解的调用


print()
print()
print()

@hook
def test1():
    print("娟娟")

    return "娟娟"
aaa =test1(a="123")  # 正常的调用
print(aaa)
